<?php
/**
 * curl
 * @link      http://book.kfsimi.cn
 * @copyright Copyright (c) 2010-2018 张锋建.
 * @package   apiframe/tools
 * @author    张锋建  mail:1224103366@qq.com
 * @version   1.0 Beta
 */
namespace apiframe\tools;
class jiqiren {



	public function post ($url, $data) {  
	    $ch = curl_init();  
	    curl_setopt($ch, CURLOPT_URL, $url);
	    curl_setopt($ch, CURLOPT_POST, 1); 
	    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); //设置缓冲等待时间
	    curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json;charset=utf-8'));
	    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //传递一个作为HTTP “POST”操作的所有数据的字符串。 
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
	    // 线下环境不用开启curl证书验证, 未调通情况可尝试添加该代码
	    // curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
	    // curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);// 对认证证书来源的检查
	    $data = curl_exec($ch);
	    curl_close($ch);                
	    return $data;  
	} 



	public function beiqia_Outgoing ($url, $data) {  
	    $ch = curl_init();  
	    curl_setopt($ch, CURLOPT_URL, $url);
	    curl_setopt($ch, CURLOPT_POST, 1); 
	    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); //设置缓冲等待时间
	    curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json;charset=utf-8'));
	    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //传递一个作为HTTP “POST”操作的所有数据的字符串。 
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
	    // 线下环境不用开启curl证书验证, 未调通情况可尝试添加该代码
	    // curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
	    // curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);// 对认证证书来源的检查
	    $data = curl_exec($ch);
	    curl_close($ch);                
	    // return $data;  

	}  
  
 

	public function dingding_zidingyi ($url, $data) {  
	    $ch = curl_init();  
	    curl_setopt($ch, CURLOPT_URL, $url);
	    curl_setopt($ch, CURLOPT_POST, 1); 
	    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); //设置缓冲等待时间
	    curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Content-Type: application/json;charset=utf-8'));
	    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //传递一个作为HTTP “POST”操作的所有数据的字符串。 
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
	    // 线下环境不用开启curl证书验证, 未调通情况可尝试添加该代码
	    // curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
	    // curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);// 对认证证书来源的检查
	    $data = curl_exec($ch);
	    curl_close($ch);                
	    return $data;  
	}  






}